package com.news.gpb.controller;

import com.news.gpb.entity.News;
import com.news.gpb.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin("http://localhost:8080")
@RestController
public class SearchController {

    @Autowired
    NewsService newsService;

    @RequestMapping("/result/{keyword}")
    List<News> search(@PathVariable(value="keyword")String keyword)
    {
        return newsService.search(keyword);
    }
}
